export default function createWebSocket() {
  return new Promise((resolve, reject) => {
    const socket = new WebSocket('ws://localhost:8899')
    socket.onopen = () => {
      console.log('连接上了ws服务')
      resolve(socket)
    }
    socket.onerror = (error) => {
      console.log('连接ws服务失败')
      reject(error)
    }
  })
}